resource "google_pubsub_topic" "topic" {
  name = "<%= ctx[:vars]['topic_name'] %>"
}

resource "google_cloud_scheduler_job" "job" {
  name        = "<%= ctx[:vars]['job_name'] %>"
  description = "test job"
  schedule    = "*/2 * * * *"

  pubsub_target {
    # topic.id is the topic's full resource name.
    topic_name = google_pubsub_topic.topic.id
    data       = base64encode("test")
  }
}
